package app.qrcode.browser.hearttoheart.activities

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.recyclerview.widget.LinearLayoutManager
import app.qrcode.browser.hearttoheart.MyApplication.Companion.context
import app.qrcode.browser.hearttoheart.R
import app.qrcode.browser.hearttoheart.adapters.SettingsImage
import app.qrcode.browser.hearttoheart.adapters.SettingsImageAdapter
import app.qrcode.browser.hearttoheart.databinding.ActivitySettingsBinding

class SettingsActivity : AppCompatActivity() {

    private lateinit var binding: ActivitySettingsBinding


    private val settingsList = ArrayList<SettingsImage>()

    private val settingsImageAdapter by lazy { SettingsImageAdapter() }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivitySettingsBinding.inflate(layoutInflater)
        setContentView(binding.root)
        initRecyclerview()
        binding.logoutBtn.setOnClickListener {
            startActivity(Intent(context, LoginChoiceActivity::class.java))
        }
    }

    private fun initRecyclerview() {
        val settingsImageLayoutManager =
            LinearLayoutManager(context)
        binding.settingRV.layoutManager = settingsImageLayoutManager
        binding.settingRV.adapter = settingsImageAdapter
        settingsList.add(SettingsImage("账号管理", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("其他模式", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("会员专属设置", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("推送通知设置", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("屏蔽设置", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("隐私设置", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("通用设置", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("客服中心", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("关于软件", R.drawable.ic_baseline_chevron_right_24))
        settingsList.add(SettingsImage("清除缓存", R.mipmap.huancun))
        settingsImageAdapter.updateList(settingsList)
    }
}